Response Settings
Once you’ve set up the request settings, you need to set up the response as well. To do so, click the Response tab and make the necessary response settings as described in this section.
General Settings
Mapping response fields
The way you map response fields depends on the Response Body Content Type and the structure of the response.
Mapping Text responses
To map Text responses, follow these steps:
- From the Response Body Content Type field, select Text.
- In the mapping table, click the Add icon displayed inline with the mapping line.
- Leave the Connector field name empty.
- In the Druid entity field name, enter the entity field where you want to save the response as a string (e.g., [[Entity]].StringField).
- Click the Save icon next to the mapping line.
- Save the integration.
Example: Text response mapping
Mapping simple and structured JSON and XML responses
To map a simple and structured JSON or XML response, follow these steps:
- From the Response Body Content Type field, select JSON or XML based on the expected response type.
- In the mapping table, click the Add icon next to the mapping line.
- In Connector field name enter the name of the property you want to map from the JSON or XML response.
- In the Druid entity field name, type [[, select the entity, then select the entity field where you want to store the property from the response.
- Click the Save icon next to the mapping line.
- Save the integration.
Map JSON response as a string
There are cases when you might want to save the entire JSON content response as a string in a DRUID entity (without mapping the specific fields in the JSON content) and pass it to other external services.
To save the full JSON content as a string, follow these steps:
- From the Response Body Content Type field, select JSON or XML based on the expected response type.
- In the mapping table, click the Add icon next to the mapping line.
- Leave the Connector field name empty.
- In the Druid entity field name, type [[, select the entity, then select the entity field where you want to save the full JSON response as string.
- Click the Save icon next to the mapping line.
- Save the integration task.
Example: Full JSON content as string mapping
Handle complex XML responses
If a GET request returns an XML response with a complex or unstructured format that prevents direct field mapping, consider the following approach:
- From the Response Body Content Type field, select XML.
- Store the entire XML response as a string in a DRUID entity field.
- Save the REST integration.
- Create a Custom Code integration after the REST integration to process the XML string.
- Use the 'Map XML string to Entity Fields' template within the Custom Code integration to map the desired XML data to DRUID entity fields.
Consume values from an entity that is global at the integration (connector action) level within an integration task with local scope
There may be scenarios where the response entity is both local and global, and it possesses distinct memory slots. You have the capability to retrieve values from a globally scoped entity at the integration (connector action) level within an integration task that has local scope.
For instance, consider a campaign scenario where an integration task with local scope is employed to create a new campaign sharing the same category as the campaign from the global entity. In the add/create integration task, referencing the [[Campaign]] with local scope, you can assign a new name and date while maintaining the category from the global entity's Campaign. To achieve this, map the relevant DRUID entity fields on the Response, assuming they exist: [[Campaign]].Name, [[Campaign]].CreationOn, and [[Campaign]]_Global.Category.